Heat Transfer lives as a subcategory of thermodynamics and is based off its ideas. Energy balance is one of thermodynamics' defining characteristics and is true for heat transfer.
Starting with the a basic energy balance about a control volume we have:
Where
We can develop this further by accounting for energy stored within a control-volume and energy generated by a control volume using the following equation:
See Section 1.3 of the textbook for more information.
This concept is applied to systems using conduction by the heat diffusion equation.